﻿using UnityEngine;
using System.Collections;

public class CameraScript : MonoBehaviour
{
    public float easySpeed = 1;
    public float mediumSpeed = 2;
    public float hardSpeed = 3;
    // Use this for initialization

    private float speed = 1;
    void Start()
    {
        if(PlayerPrefs.GetInt(GamePreference.Easy) == 1) {
            speed = easySpeed;
        }

        if(PlayerPrefs.GetInt(GamePreference.Medium) == 1) {
            speed = mediumSpeed ;
        }

        if(PlayerPrefs.GetInt(GamePreference.Hard) == 1) {
            speed = hardSpeed  ;
        }
    }
	
    // Update is called once per frame
    void Update()
    {
        MoveCamera();
    }

    void MoveCamera()
    {
        var oldY = this.gameObject.transform.localPosition;
        oldY.y = oldY.y - speed * Time.deltaTime;
        this.gameObject.transform.localPosition = oldY;
    }
}
